<template>
  <div class="page">
    <du-nav-bar title="资产" :url-obj="{ path: '/', query: { redirect: '/assets' } }"></du-nav-bar>
    <div class="page-box">
      <div>
        <du-icon name="icon-financial_fill" size="0.6rem" color="#ff7f07"></du-icon>
        <span>资产信息123</span>
      </div>
      <div class="con-box">
        <h2>查看图标方法</h2>
        <p>1. 地址 src/assets/font/demo_index.html</p>
        <p>2. 点击 Font class</p>
        <p>3. 右键属性，查看源码</p>
        <p>4. 找到span标签</p>
      </div>

      <div class="con-box">
        <h2>下载</h2>
        <p @click="todownload(1)">1. DuUtil.fechDownLoad()</p>
        <p @click="todownload(2)">2. DuUtil.downloadByBlob()</p>
        <p @click="todownload(3)">3. DuUtil.downloadByData()</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import useGoto from '@/hooks/useGoto'
const { goto } = useGoto()
const todownload = (state) => {
  // fech下载
  if (state == 1) {
    DuUtil.downloadByFetch(
      'https://img1.baidu.com/it/u=1016138010,1907110459&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
      '下载'
    )
  }
  // blob: URL
  if (state == 2) {
    DuUtil.downloadByBlob(
      'https://img1.baidu.com/it/u=1016138010,1907110459&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
      '下载'
    )
  }
  // blob: URL
  if (state == 3) {
    DuUtil.downloadByData(
      'https://img1.baidu.com/it/u=1016138010,1907110459&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
      '下载'
    )
  }
}
</script>

<style scoped lang="scss">
span {
  vertical-align: middle;
}
.con-box {
  padding: var(--app-padding);
}
p {
  line-height: 50px;
}
</style>
